import request from '@/utils/request'

// 查询借支权限列表
export function listBorrowing(query) {
  return request({
    url: '/manage/borrowing/list',
    method: 'get',
    params: query
  })
}

// 查询借支权限详细
export function getBorrowing(userId) {
  return request({
    url: '/manage/borrowing/' + userId,
    method: 'get'
  })
}
// 非管理员查询自身借支权限
export function getInfoByUserId() {
  return request({
    url: '/manage/borrowing/info',
    method: 'get'
  })
}

// 新增借支权限
export function addBorrowing(data) {
  return request({
    url: '/manage/borrowing',
    method: 'post',
    data: data
  })
}

// 修改借支权限
export function updateBorrowing(data) {
  return request({
    url: '/manage/borrowing',
    method: 'put',
    data: data
  })
}

// 删除借支权限
export function delBorrowing(userId) {
  return request({
    url: '/manage/borrowing/' + userId,
    method: 'delete'
  })
}
